<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width">
<cfinclude template = "includes/loadvars.cfm">
<cfinclude template = "includes/metadata.cfm">

<cfif NOT cgi.SCRIPT_NAME CONTAINS '/dialogs' AND NOT cgi.SCRIPT_NAME CONTAINS '/cfcs'> <!---If it's a dialog it will need to have it's own links to styles and scripts--->
<cfinclude template = "includes/loadstyles.cfm">
<cfinclude template = "includes/loadscripts.cfm">
</cfif>
<!---load any additional custom includes--->
<cfif directoryexists('#request.basepath#includes/custom')>
	<cfdirectory action="list" directory="#request.basepath#includes/custom" name="qincludes" type="file">
	<cfloop query = "qincludes">
    	<cfinclude template ="#request.absolutepath#includes/custom/#qincludes.name#">         
	</cfloop>
</cfif>
<!---Hooks: if a component is being called see if their are any scripts that need to be called before the header loads.--->
<cfif len(trim(c)) GT 0>
	<cfif fileexists('#request.basepath#components/#c#/chooks/onheaderload.cfm')>
    	<cfinclude template="#request.absolutepath#components/#c#/chooks/onheaderload.cfm">
    </cfif>
</cfif>
<cfif NOT fileexists('#request.basepath#includes/onheaderload.cfm') OR isdefined('url.init')>
	<cfif qcs.recordcount GT 1>
		<cfset includesfile = "">
        <cffile action="write" file="#request.basepath#includes/onheaderload.cfm" output="#includesfile#">
		<cfloop query="qcs">
			<cfif fileexists('#request.basepath#components/#qcs.name#/hooks/onheaderload.cfm')>
      			<cfset thisline = '<cfinclude template="#request.absolutepath#components/#qcs.name#/hooks/onheaderload.cfm">'>
				<cffile action="append" file="#request.basepath#includes/onheaderload.cfm" output="#thisline#" addnewline="yes">
    		</cfif>
		</cfloop>
	</cfif>
</cfif>
<cfinclude template="#request.absolutepath#includes/onheaderload.cfm">
<cfif fileexists('#request.basepath#includes/hooks/onheaderload.cfm')>
	<cfinclude template="#request.absolutepath#includes/hooks/onheaderload.cfm">
</cfif>
</head>
<body>
<cfif NOT cgi.SCRIPT_NAME CONTAINS '/dialogs' AND NOT cgi.SCRIPT_NAME CONTAINS '/cfcs'> <!---does not load the header if this script is located in a "/dialogs" folder--->
<cfif fileexists('#request.basepath#themes/#request.site_theme#/layouts/#request.layout#/header.cfm')>
	<cfinclude template="#request.absolutepath#themes/#request.site_theme#/layouts/#request.layout#/header.cfm">
</cfif>
<!---load component specific layout within the layout if one exists--->
<cfif len(trim(request.layoutinclude))>
	<cfif fileexists('#request.basepath#themes/#request.site_theme#/layouts/#request.layoutinclude#/include_header.cfm')>
		<cfinclude template="#request.absolutepath#themes/#request.site_theme#/layouts/#request.layoutinclude#/include_header.cfm">
	</cfif>
</cfif>
</cfif>
<!---Hooks: if a component is being called see if their are any compontent specific scripts that need to be called before the body loads.--->
<cfif len(trim(c)) GT 0>
	<cfif fileexists('#request.basepath#components/#c#/chooks/onbodyload.cfm')>
    	<cfinclude template="#request.absolutepath#components/#c#/chooks/onbodyload.cfm">
    </cfif>
</cfif>
<cfif NOT fileexists('#request.basepath#includes/onbodyload.cfm') OR isdefined('url.init')>
	<cfif qcs.recordcount GT 1>
		<cfset includesfile = "">
        <cffile action="write" file="#request.basepath#includes/onbodyload.cfm" output="#includesfile#">
		<cfloop query="qcs">
			<cfif fileexists('#request.basepath#components/#qcs.name#/hooks/onbodyload.cfm')>
      			<cfset thisline = '<cfinclude template="#request.absolutepath#components/#qcs.name#/hooks/onbodyload.cfm">'>
				<cffile action="append" file="#request.basepath#includes/onbodyload.cfm" output="#thisline#" addnewline="yes">
    		</cfif>
		</cfloop>
	</cfif>
</cfif>
<cfinclude template="#request.absolutepath#includes/onbodyload.cfm">
<cfif fileexists('#request.basepath#includes/hooks/onbodyload.cfm')>
	<cfinclude template="#request.absolutepath#includes/hooks/onbodyload.cfm">
</cfif>